<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.process</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.process";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.process.html" class="symbol">std.process</a></h1>
  
<p class="sec_header">Authors:</p><a href="http://digitalmars.com">Walter Bright</a>, <a href="http://erdani.org">Andrei
Alexandrescu</a>
<dl>
<dt class="decl">int <a class="symbol _function" name="system" href="./htmlsrc/std.process.html#L75" kind="function" beg="75" end="85">system</a><span class="params">(string <em>command</em>)</span>; <a title="Permalink to this symbol" href="#system" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L75">#</a></dt>
<dd class="ddef">
<div class="summary">Execute <span class="d_psymbol"><i>command</i></span> in a _command shell.</div>
<p class="sec_header">Returns:</p>If <span class="d_psymbol"><i>command</i></span> is null, returns nonzero if the _command
   interpreter is found, and zero otherwise. If <span class="d_psymbol"><i>command</i></span> is not
   null, returns -1 on error, or the exit status of command (which may
   in turn signal an error in command's execution).
<p class="sec_header">Note:</p>On Unix systems, the homonym C function (which is accessible
   to D programs as <a href="std_c_process.html">std.c._system</a>)
   returns a code in the same format as
   <a href="http://www.scit.wlv.ac.uk/cgi-bin/mansec?2+waitpid">waitpid</a>,
   meaning that C programs must use the <span class="d_psymbol"><i>WEXITSTATUS</i></span> macro to
   extract the actual exit code from the <span class="d_psymbol"><i>system</i></span> call. D's <span class="d_psymbol"><i>
   system</i></span> automatically extracts the exit status.</dd>
<dt class="decl">void <a class="symbol _function" name="toAStringz" href="./htmlsrc/std.process.html#L87" kind="function" beg="87" end="94">toAStringz</a><span class="params">(in string[] <em>a</em>, const( char)** <em>az</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#toAStringz" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L87">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">alias std.c.process._P_WAIT <a class="symbol _alias" name="P_WAIT" href="./htmlsrc/std.process.html#L113" kind="alias" beg="113" end="113">P_WAIT</a>; <a title="Permalink to this symbol" href="#P_WAIT" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L113">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">alias std.c.process._P_NOWAIT <a class="symbol _alias" name="P_NOWAIT" href="./htmlsrc/std.process.html#L114" kind="alias" beg="114" end="114">P_NOWAIT</a>; <a title="Permalink to this symbol" href="#P_NOWAIT" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L114">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="spawnvp" href="./htmlsrc/std.process.html#L116" kind="function" beg="116" end="130">spawnvp</a><span class="params">(int <em>mode</em>, string <em>pathname</em>, string[] <em>argv</em>)</span>; <a title="Permalink to this symbol" href="#spawnvp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L116">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="_spawnvp" href="./htmlsrc/std.process.html#L135" kind="function" beg="135" end="184">_spawnvp</a><span class="params">(int <em>mode</em>, in char * <em>pathname</em>, in char ** <em>argv</em>)</span>; <a title="Permalink to this symbol" href="#_spawnvp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L135">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">bool <a class="symbol _function" name="stopped" href="./htmlsrc/std.process.html#L187" kind="function" beg="187" end="187">stopped</a><span class="params">(int <em>status</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#stopped" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L187">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">bool <a class="symbol _function" name="signaled" href="./htmlsrc/std.process.html#L188" kind="function" beg="188" end="188">signaled</a><span class="params">(int <em>status</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#signaled" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L188">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="termsig" href="./htmlsrc/std.process.html#L189" kind="function" beg="189" end="189">termsig</a><span class="params">(int <em>status</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#termsig" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L189">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">bool <a class="symbol _function" name="exited" href="./htmlsrc/std.process.html#L190" kind="function" beg="190" end="190">exited</a><span class="params">(int <em>status</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#exited" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L190">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="exitstatus" href="./htmlsrc/std.process.html#L191" kind="function" beg="191" end="191">exitstatus</a><span class="params">(int <em>status</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#exitstatus" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L191">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="execv" href="./htmlsrc/std.process.html#L204" kind="function" beg="204" end="211">execv</a><span class="params">(in string <em>pathname</em>, in string[] <em>argv</em>)</span>; <a title="Permalink to this symbol" href="#execv" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L204">#</a></dt>
<dt class="decl">int <a class="symbol _function" name="execve" href="./htmlsrc/std.process.html#L214" kind="function" beg="214" end="223">execve</a><span class="params">(in string <em>pathname</em>, in string[] <em>argv</em>, in string[] <em>envp</em>)</span>; <a title="Permalink to this symbol" href="#execve" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L214">#</a></dt>
<dt class="decl">int <a class="symbol _function" name="execvp" href="./htmlsrc/std.process.html#L226" kind="function" beg="226" end="233">execvp</a><span class="params">(in string <em>pathname</em>, in string[] <em>argv</em>)</span>; <a title="Permalink to this symbol" href="#execvp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L226">#</a></dt>
<dt class="decl">int <a class="symbol _function" name="execvpe" href="./htmlsrc/std.process.html#L236" kind="function" beg="236" end="284">execvpe</a><span class="params">(in string <em>pathname</em>, in string[] <em>argv</em>, in string[] <em>envp</em>)</span>; <a title="Permalink to this symbol" href="#execvpe" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L236">#</a></dt>
<dd class="ddef">
<div class="summary">Execute program specified by pathname, passing it the arguments (argv)
 and the environment (envp), returning the exit status.
 The 'p' versions of exec search the PATH environment variable
 setting for the program.</div></dd>
<dt class="decl">alias std.c.process.getpid <a class="symbol _alias" name="getpid" href="./htmlsrc/std.process.html#L288" kind="alias" beg="288" end="288">getpid</a>; <a title="Permalink to this symbol" href="#getpid" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L288">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="shell" href="./htmlsrc/std.process.html#L313" kind="function" beg="313" end="335">shell</a><span class="params">(string <em>cmd</em>)</span>; <a title="Permalink to this symbol" href="#shell" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L313">#</a></dt>
<dd class="ddef">
<div class="summary">Runs <span class="d_param">cmd</span> in a shell and returns its standard output. If
   the process could not be started or exits with an error code,
   throws an exception.</div>
<p class="sec_header">Example:</p><pre class="d_code">
<span class="k">auto</span> <span class="i">tempFilename</span> = <span class="i">chomp</span>(<span class="i">shell</span>(<span class="sl">"mcookie"</span>));
<span class="k">auto</span> <span class="i">f</span> = <span class="i">enforce</span>(<span class="i">fopen</span>(<span class="i">tempFilename</span>), <span class="sl">"w"</span>);
<span class="k">scope</span>(<span class="i">exit</span>)
{
    <span class="i">fclose</span>(<span class="i">f</span>) == <span class="n">0</span> || <span class="k">assert</span>(<span class="k">false</span>);
    <span class="i">system</span>(<span class="sl">"rm "</span> ~ <span class="i">tempFilename</span>);
}
... <span class="i">use</span> <span class="i">f</span> ...
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.process.html#L337" kind="unittest" beg="337" end="344">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L337">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">string <a class="symbol _function" name="getenv" href="./htmlsrc/std.process.html#L351" kind="function" beg="351" end="356">getenv</a><span class="params">(in char[] <em>name</em>)</span>; <a title="Permalink to this symbol" href="#getenv" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L351">#</a></dt>
<dd class="ddef">
<div class="summary">Gets the value of environment variable <span class="d_psymbol"><i>name</i></span> as a string. Calls
<a href="std_c_stdlib.html#_getenv">std.c.stdlib._getenv</a>
internally.</div></dd>
<dt class="decl">void <a class="symbol _function" name="setenv" href="./htmlsrc/std.process.html#L365" kind="function" beg="365" end="369">setenv</a><span class="params">(in char[] <em>name</em>, in char[] <em>value</em>, bool <em>overwrite</em>)</span>; <a title="Permalink to this symbol" href="#setenv" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L365">#</a></dt>
<dd class="ddef">
<div class="summary">Sets the value of environment variable <span class="d_psymbol"><i>name</i></span> to <span class="d_psymbol"><i>value</i></span>. If the
value was written, or the variable was already present and <span class="d_psymbol"><i>
overwrite</i></span> is false, returns normally. Otherwise, it throws an
exception. Calls <a href="std_c_stdlib.html#_setenv">
std.c.stdlib._setenv</a> internally.</div></dd>
<dt class="decl">void <a class="symbol _function" name="unsetenv" href="./htmlsrc/std.process.html#L375" kind="function" beg="375" end="378">unsetenv</a><span class="params">(in char[] <em>name</em>)</span>; <a title="Permalink to this symbol" href="#unsetenv" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L375">#</a></dt>
<dd class="ddef">
<div class="summary">Removes variable <span class="d_psymbol"><i>name</i></span> from the environment. Calls <a href="
std_c_stdlib.html#_unsetenv">std.c.stdlib._unsetenv</a> internally.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:2" href="./htmlsrc/std.process.html#L380" kind="unittest" beg="380" end="389">unittest</a>; <a title="Permalink to this symbol" href="#unittest:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.process.html#L380">#</a></dt>
<dd class="ddef"></dd></dl>
</div>
<div id="footer">
  <p>Copyright © 1999-2008 by Digital Mars ®, All Rights Reserved.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Dec 28 04:26:42 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>